package com.itheima.web;

import com.alibaba.dubbo.config.annotation.Reference;
import com.itheima.constant.MessageConstant;
import com.itheima.entity.Result;
import com.itheima.service.OrderSettingService;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

/**
 * @version V1.0
 * @author: ljx
 * @date: 2020/01/14 21:31
 * @description:
 */
@RestController
@RequestMapping("/ordersetting")
public class RrderSettingController {

    @Reference(cluster = "failfast")
    private OrderSettingService orderSettingService;

    @RequestMapping("/findOrders")
    public Result findOrders(@RequestBody Map date){
        Result result = null;
        String month = (String) date.get("month");
        try {
            result = orderSettingService.findOrders(month);
            return result;
        } catch (Exception e) {
            e.printStackTrace();
            return new Result(false, MessageConstant.QUERY_ORDER_FAIL);
        }
    }
}
